﻿<template>
    <Modal v-model="isShow" class="modalwarp"  :width="420" title="审核" @on-cancel="Modal_cencel">
        <div class="model-wraper" > 
            <Form ref="formValidate" :model="formInfo"> <!-- @keydown.enter.prevent="Modal_ok" -->
                <div >
                    <RadioGroup v-model="formInfo.optStatus">
                        <Radio :label="1" class="black_theme" size="large">通过</Radio>
                        <Radio :label="2" class="black_theme" size="large">拒绝</Radio>
                    </RadioGroup>
                </div>
                <div>
                    <div style="margin: 10px 0 8px">审核说明：</div>
                    <Input 
                        type="textarea" show-word-limit
                        :autosize="{minRows: 4,maxRows: 8}" 
                        v-model="formInfo.goodsReportReason" 
                        class="fromInput"
                    ></Input>
                </div>
            </Form>
        </div>
        <div slot="footer">
            <Button size="large" @click="Modal_cencel">取消</Button>
            <Button :loading="save_loading" type="primary" size="large" @click="Modal_ok">确定</Button>
        </div>
    </Modal>
</template>
<script>
    export default {
        name: 'AuditPopup',
        props: ['value','id'],
        data() {
            return {
                save_loading: false,
                formInfo: {
                    optStatus: 1,
                    goodsReportReason: '',
                },
            }
        },
        created() {

        },
        computed: {
            isShow: {
                get(){
                    return this.value
                },
                set(newVal){
                    this.$emit("input", newVal); 
                }
            }
        },
        methods: {
            Modal_cencel(){
                this.isShow = false;
                this.$nextTick(this.$refs['formValidate'].resetFields);
            },
            async Modal_ok() {
                this.save_loading = true
                let requedata = this.$cloneObj(this.formInfo);
                requedata.id = this.id;
                let res = await this.$post('goodsAuditApprove',requedata);
                this.save_loading = false
                if(res) {
                    this.$tipsMessage('保存成功',1);
                    this.Modal_cencel();
                    this.$emit('ok');
                }
            },
        },
        watch: {
        }
    };
</script>